^ What's the point?
^ Installation
^ Hints
^ Useful information

Download :: Top
Sledge Process Library

Sledge Process Library is a component for Delphi (Win32, Win64) based on Graphics32 and a native FireMonkey component that provides a powerful user configurable process construction.
The package consists of a base, 'root' component, multiple task components that perform the work within the process and a visual process editor component.
The app. implements the tasks and the user can construct a custom process from these tasks.
There are 3 different task objects: a simple 'task' item, that receives an input, performs a work, and returns an output, a 'case' item that receives an input and decides at which output to forward the input class object and continue the process, and a 'result' item, that can be used to perform an ending stage for the process. All these items' pins can be connected visually with the mouse in the editor.
The component also allows saving and loading of the process configuration with a preset system.

Features:
  • The user can construct a custom process to run from the available task components
  • 'Task' (worker), 'Case' (conditional branching with unlimited output cases) and 'Results' items
  • Powerful visual editor for the user to define the process
  • Inputs can have multiple sources and outputs can have multiple destinations
  • Task items accept a defined input class and output a defined output class, task items that are compatible can be only conected in editor
  • Preset system for loading and saving of the defined process
  • Completely configurable editor appearance: colors, fonts, item sizes, icons
  • Very easy to implement Delphi style design
Click here for an example implementation in Batch Sledge Photo Processor application (with snapshot).

This is the first release of the component, please contact me if You find any bugs.

The FireMonkey version of the visual aditor is in beta stage.

You should see the included example program tutorials' source codes for example of how to use the components in your own programs.

Requirements

Delphi 2009 and above with Graphics32 installed or Delphi with FireMonkey.


Sledge Process Library in shareware and commercial software?

The component is free for use in free software. If you like it and use it in a shareware or commercial (or any other money making - advertising, in app. selling, etc.) product one of the licenses is needed.


Installation

If Graphics32 is not already installed, install it (only needed for the VCL version) - Graphics32 is a great component you might want to decide to use it.

Install a desired package from the 'Packages' folder. Note that currently you have to choose either the VCL or the FMX version. It is not possible to install both at the same time.

Or to create a new package from scratch:
  • Create a new package, menu: File/New/Package - Delphi, save it with a new name, menu: File/Save Project As.... for example 'PackageSledgeProcess.bpl'.
  • On the upper-right corner of the Delphi window right mouse click on the package name you saved as, and click on 'Add' from the pop-up menu and add 'SledgeProcess.pas', 'SledgeProcessEditor.pas' and 'SledgeProcessEditorPresets.pas'.
  • If you wish to install the FireMonkey version add 'SledgeProcess.pas', 'FMX.SledgeProcessEditor.pas' and 'FMX.SledgeProcessEditorPresets.pas' instead.
  • Add the directories to the all required .pas files to the search path too - Menu: Project/Options, select 'Delphi compiler', in the upper part of the window select 'All configuration', below click on 'Search path' and add the paths where you installed/extracted Graphics32 and Sledge Process Library files.
  • Right mouse click again on the package name and select 'Build', if successfull, again right mouse click and select 'Install'.
If everything went smoothly the Sledge Process components will show up on the '3delite's Sledge Process Library' tab.


Hints

  • Image lists have 2 fixed icon indexes: Index 0 is for the 'Remove' and Index 1 is for the 'Clear all' tool button's icons.

  • 'AutoFree' properties, if set to True, frees the input and output object classes accordingly after the connected task's worker function returns. Design your implementation precisely if You wish to use this feature.

  • Derive your task information object from 'TSledgeTaskDataBase' class and implement the 'Clone' method for built-in support of multiple outputs per pin.
    If the given task item has more than 1 outputs connected the library will automatically clone the object for every output.
    If You don't derive from 'TSledgeTaskDataBase' all the connected tasks will receive the same object that goes along in the chain in the order of the connections (You probably don't want this but it's possible to design the process for this).

  • Derive the initial object from 'TSledgeBatchWork' that is passed to the root component 'TSledgeProcess.Execute' to automatically process multiple jobs in the 'TSledgeBatchWork.Jobs' array.

  • Derive the initial object from 'TSledgeBatchWorkMultiThreaded' that is passed to the root component 'TSledgeProcess.Execute' for built-in support of multi-threaded execution of the jobs.
    Every object in 'TSledgeBatchWorkMultiThreaded.Jobs' array will spawn a new thread. All the task item worker events need to be thread-safe.
    If You derive your task information object from 'TSledgeTaskDataBase' it's 'Clone' method must be thread safe too.
    Use 'TSledgeProcess.ThreadsWorking' function (maybe in a Timer) to check if the threads are still working.
    Also the task information object needs to be freed by your code manually when using the multi-threading option.

  • OnTaskFunctionResult event: This event can be utilised for all task items at once, for example to preview any stage of the process. Example code, following the Advanced tutorial:
    	function TForm1.SledgeTask1TaskFunctionResult(Sender: TSledgeTaskBase; Output: TObject): Boolean;
    	var
    		MyData: TMySledgeData;
    	begin
    		Result := True;
    		MyData := Output as TMySledgeData;
    		if JustPreviewInput then begin
    			if SledgeProcessEditor1.SelectedItem.SledgeItem.IDChain = Sender.IDChain then begin
    				ImgView32OutputPreview.Bitmap.Assign(MyData.Bitmap32);
    				Result := False;
    			end;
    		end;
    	end;
    	
  • Return 'Result := False' to stop the process advancing - we already displayed the preview.

  • DPI scaling: use 'SledgeProcessEditor1.ItemOptions.ScaleBy(1.5)' for 150% scaling.

  • FireMonkey task buttons: To customize the task button tool bar add a TSpeedButton to the form, right mouse button click on it and select 'Edit Custom Style...'. In the upper-left part of the window click on 'SpeedButtonstyle' then in the Object Inpsector click on 'StyleName' and change it to 'SledgeSpeedButtonstyle', the component will use this style. Again in the upper-left part of the screen expand this item and use the 'glyphstyle' 'Height' and 'Width' properties to specify the task tool bar icon size. Close this window and click on 'Yes' to apply these changes. Delete the TSPeedButton and save the project.


Useful information


[Top]